home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / dalla rivista / host contacted / jikes.lha / jikes-1.11 / src / javaprs.h < prev    next >
C/C++ Source or Header  |  2000-01-16  |  3KB  |  85 lines

  1. // $Id: javaprs.h,v 1.13 1999/10/17 02:02:12 shields Exp $
  2. // This software is subject to the terms of the IBM Jikes Compiler
  3. // License Agreement available at the following URL:
  4. // http://www.ibm.com/research/jikes.
  5. // Copyright (C) 1996, 1998, International Business Machines Corporation
  6. // and others.  All Rights Reserved.
  7. // You must accept the terms of that agreement to use this software.
  8. //
  9. #ifndef javaprs_INCLUDED
  10. #define javaprs_INCLUDED
  11.  
  12. #define SCOPE_REPAIR
  13. #define DEFERRED_RECOVERY
  14. #define FULL_DIAGNOSIS
  15. #define SPACE_TABLES
  16.  
  17. class LexStream;
  18.  
  19. class javaprs_table
  20. {
  21. public:
  22.     static int original_state(int state) { return -base_check[state]; }
  23.     static int asi(int state) { return asb[original_state(state)]; }
  24.     static int nasi(int state) { return nasb[original_state(state)]; }
  25.     static int in_symbol(int state) { return in_symb[original_state(state)]; }
  26.  
  27.     static const unsigned char  rhs[];
  28.     static const   signed short check_table[];
  29.     static const   signed short *base_check;
  30.     static const unsigned short lhs[];
  31.     static const unsigned short *base_action;
  32.     static const unsigned char  term_check[];
  33.     static const unsigned short term_action[];
  34.  
  35.     static const unsigned short asb[];
  36.     static const unsigned char  asr[];
  37.     static const unsigned short nasb[];
  38.     static const unsigned short nasr[];
  39.     static const unsigned short name_start[];
  40.     static const unsigned char  name_length[];
  41.     static const          char  string_buffer[];
  42.     static const unsigned short terminal_index[];
  43.     static const unsigned short non_terminal_index[];
  44.     static const unsigned short scope_prefix[];
  45.     static const unsigned short scope_suffix[];
  46.     static const unsigned short scope_lhs[];
  47.     static const unsigned char  scope_la[];
  48.     static const unsigned char  scope_state_set[];
  49.     static const unsigned short scope_rhs[];
  50.     static const unsigned short scope_state[];
  51.     static const unsigned short in_symb[];
  52.  
  53.     static int nt_action(int state, int sym)
  54.     {
  55.         return base_action[state + sym];
  56.     }
  57.  
  58.     static int t_action(int act, int sym, LexStream *stream)
  59.     {
  60.         act = base_action[act];
  61.         int i = act + sym;
  62.  
  63.         act = term_action[term_check[i] == sym ? i : act];
  64.  
  65.         if (act > LA_STATE_OFFSET)
  66.         {
  67.             for (TokenObject tok = stream -> Peek();
  68.                  ;
  69.                  tok = stream -> Next(tok))
  70.             {
  71.                act -= LA_STATE_OFFSET;
  72.                sym = stream -> Kind(tok);
  73.                i = act + sym;
  74.                act = term_action[term_check[i] == sym ? i : act];
  75.                if (act <= LA_STATE_OFFSET)
  76.                    break;
  77.             } 
  78.         }
  79.  
  80.         return act;
  81.     }
  82. };
  83.  
  84. #endif /* javaprs_INCLUDED */
  85.